import { ApiProperty } from '@nestjs/swagger';
import {
  IsBoolean,
  IsEnum,
  IsNotEmpty,
  IsOptional,
  IsString,
} from 'class-validator';
import { $Enums } from '@prisma/client';
export class UserEntity {
  id?: string;
  @ApiProperty({
    description: '用户名',
  })
  @IsString()
  @IsNotEmpty()
  username: string;
  @ApiProperty({
    description: '密码',
  })
  @IsString()
  @IsNotEmpty()
  password: string;
  @IsString()
  iv?: string | null;
  @IsString()
  key?: string | null;
  @ApiProperty({
    description: '姓名',
  })
  @IsString()
  @IsOptional()
  name?: string | null;
  @ApiProperty({
    description: '头像',
    default: null,
  })
  @IsString()
  @IsOptional()
  avatar?: string | null;
  @IsString()
  @IsOptional()
  openid?: string | null;
  @ApiProperty({
    description: '联系电话',
  })
  @IsString()
  @IsOptional()
  mobile?: string | null;
  @ApiProperty({
    description: '是否禁用',
    default: false,
  })
  @IsBoolean()
  @IsOptional()
  disabled?: boolean;
  @ApiProperty({
    description: '备注',
  })
  @IsString()
  @IsOptional()
  remark?: string | null;

  @ApiProperty({
    default: $Enums.userRole.worker,
    enum: $Enums.userRole,
  })
  @IsEnum($Enums.userRole)
  role: $Enums.userRole;

  viewId?: string | null;
  createdAt?: number | null;
  updatedAt?: number | null;
}
